The B-Dienst (German: Beobachtungsdienst, observation service), also called xB-Dienst, X-B-Dienst and χB-Dienst, was a Department of the German Naval Intelligence Service (German: Marinenachrichtendienst, MND III) of the OKM, that dealt with the interception and recording, decoding and analysis of the enemy, in particular British radio communications before and during World War II. B-Dienst worked on cryptanalysis and deciphering (decrypting) of enemy and neutral states' message traffic and security control of Kriegsmarine key processes and machinery.
B-Dienst was instrumental in moulding Wehrmacht operations during the Battles of Norway and France in spring 1940, primarily due to the cryptanalysis successes it had achieved against early and less secure British Naval cyphers.
B-Dienst broke British Naval Combined Cypher No. 3 in October 1941, which was used to encrypt all communications between naval personnel, for Allied North Atlantic convoys. This enabled B-Dienst to provide valuable signals intelligence for the German Navy in the Battle of the Atlantic. The intelligence flow largely ended when the Admiralty introduced Naval Cypher No. 5 on 10 June 1943. The new cypher became secure in January 1944 with the introduction of the Stencil Subtractor system which was used to recypher it.